<?php

namespace App\Http\Controllers\Api;
use App\Blocks\GoodsBlock;
use App\Http\Controllers\Controller;
use App\Libs\ResponseMessage;
use App\Models\Carts;
use Illuminate\Http\Request;

class GoodsController extends Controller {

    public function getGoods(Request $request){
        $page = $request->get('page', 1);
        $pageSize = $request->get('pageSize', 20);

        global $g_uid;

        $search = [];

        $goodsBlock = new GoodsBlock();

        $goods = $goodsBlock->getGoods($g_uid, $search, $page, $pageSize);

        return response()->json(ResponseMessage::getInstance()->success($goods)->response());
    }

    public function getGoodsInfo($id){
        global $g_uid;
        $goodsBlock = new GoodsBlock();

        $info = $goodsBlock->getGoodsInfo($g_uid, $id);

        return response()->json(ResponseMessage::getInstance()->success($info)->response());

    }
}